#!/bin/bash
#--------------------------------------------------
# This script is for: 安装基础环境
#--------------------------------------------------

set -o nounset
set -o errexit
#set -o xtrace

# 清掉文件
if [ -d "config" ];then
	rm config
fi

if [ -d "my.cnf" ];then
	rm my.cnf
fi

if [ -d "90-dev-compose-platform-min.yaml" ];then
	rm 90-dev-compose-platform-min.yaml
fi

# 下载文件
PLATFORM_MIN_URL=http://training-static.linesno.com/90-dev-compose-platform-min.yaml
MYSQL_CONF_URL=http://training-static.linesno.com/mysql.cnf

curl -C- -O --retry 3 "$PLATFORM_MIN_URL"
curl -C- -O --retry 3 "$MYSQL_CONF_URL"

mkdir config
cp -af mysql.cnf ./config/

yum install docker
yum install docker-compose

systemctl restart docker
docker-compose -f 90-dev-compose-platform-min.yaml up -d